package doublepoint;

/**
 * @Author: 海琳琦
 * @Date: 2022/2/3 2:22
 * https://leetcode-cn.com/problems/move-zeroes/
 */
public class MoveZeroes {

    public void moveZeroes(int[] nums) {
        int firstIndex = 0, temp;
        for (int endIndex = 0; endIndex < nums.length; endIndex++) {
            if (nums[endIndex] != 0) {
                temp = nums[firstIndex];
                nums[firstIndex] = nums[endIndex];
                nums[endIndex] = temp;
                firstIndex++;
            }
        }
    }

    public static void main(String[] args) {

    }
}
